export function formatAmount(amount, zero) {
	if (typeof amount !== 'number') {
		amount = Number(amount)
		if (typeof amount !== 'number' || isNaN(amount)) {
			if (zero) {
				return '0';
			} else {
				return '0.00';
			}
		}


	}
	const amountStr = amount.toFixed(2);
	const [integerPart, decimalPart] = amountStr.split('.');
	const integerWithCommas = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
	if(zero) {
		return `${integerWithCommas}`;
	} else {
		return `${integerWithCommas}.${decimalPart}`;
	}
	
}